package dao

import (
	"go-exp/query"
	"gorm.io/gorm"
)

type DAO struct {
	db    *gorm.DB
	Query *query.Query // 生成的查询对象
}

func NewDAO(db *gorm.DB) (*DAO, error) {
	// 初始化查询引擎
	q := query.Use(db)

	return &DAO{
		db:    db,
		Query: q,
	}, nil
}
